package cz.muni.fi.hauntedhouses;

import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Vanda Cabanová, 325371
 */
@Local
public interface HumanDAOLocal {
    /**
     * Creates new human
     * @param human Human to create
     * @throws NullPointerException when parameter is null
     */
    void create(HumanTO humanTo);
    
    /**
     * Updates given Human. If given Human does not exist in the database,
     * it is only created.
     * @param human Human with new parameters
     * @throws NullPointerException on null given
     */
    void update(HumanTO humanTo);
    
    /**
     * Removes given Human. If given Human is not in the database, nothing happens
     * since it was intented not to have it in DB anymore.
     * @param human Human to be removed
     * @throws NullPointerException if given parameter is null
     * 
     */
    void remove(HumanTO humanTo);
    
    /**
     * Returns Human with given ID
     * @param id ID from database
     * @return Human with given ID
     * @throws IllegalArgumentException if id is null or less than 1
     */
    HumanTO get(Long id);   
    
    /**
     * Returns list of all existing Humans from DB
     * @return List of Humans
     */
    List<HumanTO> findAll();
    
    /**
     * Returns list of all existing Humans with given name from DB.
     * Returns empty collection if there is no such Human.
     * @param name a human name
     * @return List of humans with given name
     */
    List<HumanTO> findByName(String name);
    
    /**
     * Returns list of all existing humans with given worst fear from DB. 
     * Returns empty collection if there is no such Human.
     * @param worstFear Human's worst fear, enum type
     * @return List of Humans with given worst fear
     */
    List<HumanTO> findByWorstFear(Fear worstFear);
    
    
    /**
     * Returns list of humans with given resistence against fears
     * Returns empty collection if there is no such Human.
     * @param resistance Parameter which indicates how resitent a human is against ghosts
     * @return List of humans with given resistence
     */
    List<HumanTO> findByResistence(int resistance);
    
    /**
     * Returns list of humans with given gender.
     * Returns empty collection if there is no such Human.
     * @param gender Gender of enum value
     * @return List of Humans with given Gender
     */
    List<HumanTO> findByGender(Gender gender);
    
        
}
